import 'package:seedfour/generated/json/base/json_convert_content.dart';
import 'package:seedfour/app/models/case_list_entity.dart';

CaseListEntity $CaseListEntityFromJson(Map<String, dynamic> json) {
  final CaseListEntity caseListEntity = CaseListEntity();
  final int? total = jsonConvert.convert<int>(json['total']);
  if (total != null) {
    caseListEntity.total = total;
  }
  final List<CaseInfo>? apply = (json['apply'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<CaseInfo>(e) as CaseInfo).toList();
  if (apply != null) {
    caseListEntity.apply = apply;
  }
  final List<CaseInfo>? settle = (json['settle'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<CaseInfo>(e) as CaseInfo).toList();
  if (settle != null) {
    caseListEntity.settle = settle;
  }
  final List<CaseInfo>? complete = (json['complete'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<CaseInfo>(e) as CaseInfo).toList();
  if (complete != null) {
    caseListEntity.complete = complete;
  }
  final List<CaseInfo>? conflict = (json['conflict'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<CaseInfo>(e) as CaseInfo).toList();
  if (conflict != null) {
    caseListEntity.conflict = conflict;
  }
  return caseListEntity;
}

Map<String, dynamic> $CaseListEntityToJson(CaseListEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['total'] = entity.total;
  data['apply'] = entity.apply?.map((v) => v.toJson()).toList();
  data['settle'] = entity.settle?.map((v) => v.toJson()).toList();
  data['complete'] = entity.complete?.map((v) => v.toJson()).toList();
  data['conflict'] = entity.conflict?.map((v) => v.toJson()).toList();
  return data;
}

extension CaseListEntityExtension on CaseListEntity {
  CaseListEntity copyWith({
    int? total,
    List<CaseInfo>? apply,
    List<CaseInfo>? settle,
    List<CaseInfo>? complete,
    List<CaseInfo>? conflict,
  }) {
    return CaseListEntity()
      ..total = total ?? this.total
      ..apply = apply ?? this.apply
      ..settle = settle ?? this.settle
      ..complete = complete ?? this.complete
      ..conflict = conflict ?? this.conflict;
  }
}

CaseInfo $CaseInfoFromJson(Map<String, dynamic> json) {
  final CaseInfo caseInfo = CaseInfo();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    caseInfo.id = id;
  }
  final String? createdAtStr = jsonConvert.convert<String>(
      json['createdAtStr']);
  if (createdAtStr != null) {
    caseInfo.createdAtStr = createdAtStr;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    caseInfo.name = name;
  }
  final String? caseNameStr = jsonConvert.convert<String>(json['caseNameStr']);
  if (caseNameStr != null) {
    caseInfo.caseNameStr = caseNameStr;
  }
  final String? caseName = jsonConvert.convert<String>(json['caseName']);
  if (caseName != null) {
    caseInfo.caseName = caseName;
  }
  final String? caseTypeStr = jsonConvert.convert<String>(json['caseTypeStr']);
  if (caseTypeStr != null) {
    caseInfo.caseTypeStr = caseTypeStr;
  }
  final String? caseStatus = jsonConvert.convert<String>(json['caseStatus']);
  if (caseStatus != null) {
    caseInfo.caseStatus = caseStatus;
  }
  final String? caseDate = jsonConvert.convert<String>(json['caseDate']);
  if (caseDate != null) {
    caseInfo.caseDate = caseDate;
  }
  final String? takerStr = jsonConvert.convert<String>(json['takerStr']);
  if (takerStr != null) {
    caseInfo.takerStr = takerStr;
  }
  final String? suitType = jsonConvert.convert<String>(json['suitType']);
  if (suitType != null) {
    caseInfo.suitType = suitType;
  }
  final String? lawsuitType = jsonConvert.convert<String>(json['lawsuitType']);
  if (lawsuitType != null) {
    caseInfo.lawsuitType = lawsuitType;
  }
  final CaseInfoCiCo? cico = jsonConvert.convert<CaseInfoCiCo>(json['cico']);
  if (cico != null) {
    caseInfo.cico = cico;
  }
  final String? clientName = jsonConvert.convert<String>(json['clientName']);
  if (clientName != null) {
    caseInfo.clientName = clientName;
  }
  final String? clientCode = jsonConvert.convert<String>(json['clientCode']);
  if (clientCode != null) {
    caseInfo.clientCode = clientCode;
  }
  final String? oppositeName = jsonConvert.convert<String>(
      json['oppositeName']);
  if (oppositeName != null) {
    caseInfo.oppositeName = oppositeName;
  }
  final String? oppositeCode = jsonConvert.convert<String>(
      json['oppositeCode']);
  if (oppositeCode != null) {
    caseInfo.oppositeCode = oppositeCode;
  }
  final String? thirdName = jsonConvert.convert<String>(json['thirdName']);
  if (thirdName != null) {
    caseInfo.thirdName = thirdName;
  }
  final String? thirdCode = jsonConvert.convert<String>(json['thirdCode']);
  if (thirdCode != null) {
    caseInfo.thirdCode = thirdCode;
  }
  final String? archive = jsonConvert.convert<String>(json['archive']);
  if (archive != null) {
    caseInfo.archive = archive;
  }
  final bool? isSignedContract = jsonConvert.convert<bool>(
      json['isSignedContract']);
  if (isSignedContract != null) {
    caseInfo.isSignedContract = isSignedContract;
  }
  return caseInfo;
}

Map<String, dynamic> $CaseInfoToJson(CaseInfo entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['createdAtStr'] = entity.createdAtStr;
  data['name'] = entity.name;
  data['caseNameStr'] = entity.caseNameStr;
  data['caseName'] = entity.caseName;
  data['caseTypeStr'] = entity.caseTypeStr;
  data['caseStatus'] = entity.caseStatus;
  data['caseDate'] = entity.caseDate;
  data['takerStr'] = entity.takerStr;
  data['suitType'] = entity.suitType;
  data['lawsuitType'] = entity.lawsuitType;
  data['cico'] = entity.cico?.toJson();
  data['clientName'] = entity.clientName;
  data['clientCode'] = entity.clientCode;
  data['oppositeName'] = entity.oppositeName;
  data['oppositeCode'] = entity.oppositeCode;
  data['thirdName'] = entity.thirdName;
  data['thirdCode'] = entity.thirdCode;
  data['archive'] = entity.archive;
  data['isSignedContract'] = entity.isSignedContract;
  return data;
}

extension CaseInfoExtension on CaseInfo {
  CaseInfo copyWith({
    String? id,
    String? createdAtStr,
    String? name,
    String? caseNameStr,
    String? caseName,
    String? caseTypeStr,
    String? caseStatus,
    String? caseDate,
    String? takerStr,
    String? suitType,
    String? lawsuitType,
    CaseInfoCiCo? cico,
    String? clientName,
    String? clientCode,
    String? oppositeName,
    String? oppositeCode,
    String? thirdName,
    String? thirdCode,
    String? archive,
    bool? isSignedContract,
  }) {
    return CaseInfo()
      ..id = id ?? this.id
      ..createdAtStr = createdAtStr ?? this.createdAtStr
      ..name = name ?? this.name
      ..caseNameStr = caseNameStr ?? this.caseNameStr
      ..caseName = caseName ?? this.caseName
      ..caseTypeStr = caseTypeStr ?? this.caseTypeStr
      ..caseStatus = caseStatus ?? this.caseStatus
      ..caseDate = caseDate ?? this.caseDate
      ..takerStr = takerStr ?? this.takerStr
      ..suitType = suitType ?? this.suitType
      ..lawsuitType = lawsuitType ?? this.lawsuitType
      ..cico = cico ?? this.cico
      ..clientName = clientName ?? this.clientName
      ..clientCode = clientCode ?? this.clientCode
      ..oppositeName = oppositeName ?? this.oppositeName
      ..oppositeCode = oppositeCode ?? this.oppositeCode
      ..thirdName = thirdName ?? this.thirdName
      ..thirdCode = thirdCode ?? this.thirdCode
      ..archive = archive ?? this.archive
      ..isSignedContract = isSignedContract ?? this.isSignedContract;
  }
}

CaseInfoCiCo $CaseInfoCiCoFromJson(Map<String, dynamic> json) {
  final CaseInfoCiCo caseInfoCiCo = CaseInfoCiCo();
  final int? cStatus = jsonConvert.convert<int>(json['cStatus']);
  if (cStatus != null) {
    caseInfoCiCo.cStatus = cStatus;
  }
  final int? oStatus = jsonConvert.convert<int>(json['oStatus']);
  if (oStatus != null) {
    caseInfoCiCo.oStatus = oStatus;
  }
  final int? iStatus = jsonConvert.convert<int>(json['iStatus']);
  if (iStatus != null) {
    caseInfoCiCo.iStatus = iStatus;
  }
  return caseInfoCiCo;
}

Map<String, dynamic> $CaseInfoCiCoToJson(CaseInfoCiCo entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['cStatus'] = entity.cStatus;
  data['oStatus'] = entity.oStatus;
  data['iStatus'] = entity.iStatus;
  return data;
}

extension CaseInfoCiCoExtension on CaseInfoCiCo {
  CaseInfoCiCo copyWith({
    int? cStatus,
    int? oStatus,
    int? iStatus,
  }) {
    return CaseInfoCiCo()
      ..cStatus = cStatus ?? this.cStatus
      ..oStatus = oStatus ?? this.oStatus
      ..iStatus = iStatus ?? this.iStatus;
  }
}